package com.wyc.controller;


import com.wyc.dto.Result;
import com.wyc.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    IFollowService followService;
    /***
     * @description: TODO :根据isFollow值改变数据库，是否关注对应userid
     * @params: [followUserId, isFollow]
     * @return: com.sengang.dto.Result
     * @author: SenGang
     */
    @PutMapping("/{FollowId}/{isFollow}")
    public Result follow(@PathVariable Long FollowId, @PathVariable boolean isFollow){

        return followService.follow(FollowId,isFollow);
    }
    /***
     * @description: TODO :查询用户是否被关注
     * @params: [followUserId]
     * @return: com.sengang.dto.Result
     * @author: SenGang
     */
    @GetMapping("/or/not/{FollowId}")
    public Result follow(@PathVariable Long FollowId){
        return followService.isFollow(FollowId);
    }
    /***
     * @description: TODO :求共同关注的id
     * @params: [userId]
     * @return: com.sengang.dto.Result
     * @author: SenGang
     */
    @GetMapping("/common/{id}")
    public Result followCommons(@PathVariable("id") Long id){
        return followService.followCommons(id);
    }
}
